import mongoose from '../dbHelper';
import {defaultSchemaExtend, defaultSchemaOptions} from "../config/index";

const Schema = mongoose.Schema;

const DlyAdminUserSchema = new Schema(Object.assign({
  userName: String, // 用户名
  phone: String, // 手机号
  password: String, // 密码
  userNum: Number, // 使用用户数量
  subuserNum: Number, // 子用户数量
  avatar: String, // 头像地址
  binkCard: String, // 银行卡号
  binkLocation: String, // 银行卡地址
  binkName: String, // 银行卡名称
  group: String, // 用户组
  permissions: Array, // 权限
  status: Number, // 状态 1启用 0禁用
  usePayment: String, // 默认收款 1银行 2支付宝
  aliAccount: String, // 支付宝账号
  aliName: String, // 支付宝姓名
  deleted: {
    type: Boolean, // 软删除
    default: false
  },
  point: {
    type: Number, // 返点
    required: true
  },
  parentId: {
    type: Schema.Types.ObjectId,  // 父级ID
    ref: 'DlyAdminUser'
  },
  role: {
    type: String,
    required: true
    // 必填
    // 枚举值 admin directproxy secondaryproxy user
  },
  roleName: {
    type: String,
    required: true
  },
  channelCode: String, // 渠道编码
  
 
}, defaultSchemaExtend), defaultSchemaOptions);

const DlyAdminUser = mongoose.model('DlyAdminUser', DlyAdminUserSchema, 'DlyAdminUsers');

export default DlyAdminUser